package com.example.demo.po;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.Min;
import lombok.*;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("product")
public class Product implements Serializable{
    @Serial
    private static final long serialVersionUID = 1L;

@TableId(type = IdType.AUTO)
    private Long id;

    private String name;

    private String description;

    @DecimalMin(value = "0.00", message = "价格必须大于0")
    private Float price;

    @Min(value = 0, message = "销量必须大于或等于0")

    private Integer sold;

    @Min(value = 0, message = "库存必须大于或等于0")

    private Integer stock;

    private Integer version;

    private String merchantName;

    private Integer status;


    private LocalDateTime createTime;

    private LocalDateTime updateTime;
}
